<template>
    <div class='container'>
        <h3 style='margin-bottom: 20px'>产成品入库单</h3>
        <el-button style='margin: 10px 0;float: right' icon='el-icon-plus' type='primary' @click='add'>新增</el-button>
        <el-table
            :data="tableData"
            border
            ref="multipleTable"
            header-cell-class-name="table-header"
        >
            <el-table-column prop="cWhCode" sortable label="仓库编码"></el-table-column>
            <el-table-column prop="cDepCode" sortable label="部门编码"></el-table-column>
            <el-table-column prop="cRdCode" sortable label=" 收发类别编码"></el-table-column>
            <el-table-column prop="materialType" sortable label="产品分类"></el-table-column>
            <el-table-column prop="cMaker" sortable label="制单人"></el-table-column>
            <el-table-column prop="sendState" sortable label="发送状态">
                <template slot-scope='{row}'>
                    {{row.sendState == 1?'失败':'成功'}}
                </template>
            </el-table-column>
            <el-table-column prop="cMemo" sortable label="备注"></el-table-column>
                <!-- TODO 苟家龙说不要了 -->
<!--            <el-table-column prop="cCode" sortable label="单据编号"></el-table-column>-->
            <el-table-column prop="createTime" sortable label="制单时间"></el-table-column>
            <el-table-column label="操作" width="150" align="center">
                <template slot-scope="{row}">
                    <el-button type='primary' @click='checkDetail(row)'>查看</el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination layout="total, prev, pager, next, jumper" :page-size="pagination.pageSize" @current-change="pageChange" :total="pagination.total" :current-page.sync="pagination.page" style="margin-top:20px"></el-pagination>
    </div>
</template>

<script>
import { selectProductStorageList } from '@/request/api';

export default {
    name: 'productStorageList',
    data() {
        return {
            tableData:[],
            pagination:{
                page:1,
                pageSize:15,
                total:0
            },
        };
    },
    mounted() {
        this.getTableDataleData();
    },
    methods:{
        add(){
            this.$router.push('/productStorageList/add')
        },
         checkDetail(params){
            let {id} = params
            this.$router.push({
                path:'/productStorageList/check',
                query:{id}
            })
        },
        async getTableDataleData() {
            let {page,pageSize} = this.pagination
            let params = {
                page,
                pageSize
            }
            const data = await selectProductStorageList(params)
            this.tableData = data.data.content
            this.pagination.total = data.data.totalElements

        },
        pageChange(page){
            this.pagination.page = page
            this.getTableDataleData()
        },
    }
}
</script>

<style scoped lang='less'>

</style>
